import {
  Column,
  CreateDateColumn,
  Entity,
  JoinColumn,
  ManyToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { Instrument } from './instrument.entity';

@Entity()
export class InstrumentMaintenance {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => Instrument)
  @JoinColumn({ name: 'instrument_id' })
  instrument: Instrument;

  @Column({ type: 'int', comment: '维修记录人id' })
  logger_id: number;

  @Column('text', { comment: '维修原因' })
  issue_desc: string;

  @Column({ type: 'bigint', comment: '维修开始时间' })
  maintenance_start_time: number;

  @Column({ type: 'bigint', comment: '维修结束时间' })
  maintenance_end_time: number;

  @CreateDateColumn()
  created_at: Date;
}
